<?php
/**
 * Created by PhpStorm.
 * User: fangwei
 * Date: 2019-06-26
 * Time: 22:40
 */

namespace App\Http\Requests\Admin;


use Illuminate\Foundation\Http\FormRequest;

class UserInputDTO extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        $id = $this->route('id');
        return [
            'username' => 'required|between:2,10|unique:users,username,'.$id,
            'nickname' => 'required|max:50',
        ];
    }

    public function messages()
    {
        return [
            'username.required' => '账号不能为空',
            'username.between' => '账号在2-10个字符以内',
            'nickname.required' => '姓名不能为空',
            'nickname.max' => '姓名不能超过50个字符',
        ];
    }
}